package 简单.相同的树;
//递归
public class Solution1 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        if(p==null && q==null) return true;
        if(p==null||q==null) return false;
        boolean left = isSameTree(p.left,q.left);
        boolean right = isSameTree(p.right,q.right);
        return (p.val == q.val && left && right);
    }
}
